***** The gap between pooled males and directly admitted females.  Table 6

clear
use "${data}cleaned_data_y3.dta"

do "${blocks}construct_new_variables"

********************************************************************************
*
*                              FIRST YEAR
*
********************************************************************************

*** All
reg ns_std_perc_y1 i.type if Course_NatSci_split~=., vce(cluster ApplyCollege)
onesided 2.type
estadd local course_fe ""
estadd local offer_college_fe ""
estadd local apply_college_fe ""
eststo r1

reg ns_std_perc_y1 i.type i.Course_NatSci_split, vce(cluster ApplyCollege)
onesided 2.type
estadd local course_fe "\checkmark"
estadd local offer_college_fe ""
estadd local apply_college_fe ""
eststo r2

*** EEMP

reg ns_std_perc_y1 i.type i.Course_NatSci_split if EEMP == 0, vce(robust)
onesided 2.type
estadd local course_fe "\checkmark"
estadd local offer_college_fe ""
estadd local apply_college_fe "\checkmark"
eststo r3

reg ns_std_perc_y1 i.type i.Course_NatSci_split if EEMP == 1, vce(robust)
onesided 2.type
estadd local course_fe "\checkmark"
estadd local offer_college_fe ""
estadd local apply_college_fe ""
eststo r4

reg ns_std_perc_y1 i.type i.Course_NatSci_split  i.ApplyCollege if EEMP == 1, vce(robust)
onesided 2.type
estadd local course_fe "\checkmark"
estadd local offer_college_fe ""
estadd local apply_college_fe "\checkmark"
eststo r5

reg ns_std_perc_y1 i.type i.Course_NatSci_split  i.ApplyCollege i.OfferCollege if EEMP == 1, vce(robust)
onesided 2.type
estadd local course_fe "\checkmark"
estadd local apply_college_fe "\checkmark"
estadd local offer_college_fe "\checkmark"
eststo r6

esttab r1 r2 r3 r4 r5 r6 using "${tables}gender_main_A.tex", cells(b(pval(pval) fmt(2)) se(par fmt(2))) keep(2.type) collabels(none) ///
scalars("course_fe Subject FE" ///
"apply_college_fe Application college FE" ///
"offer_college_fe Offer college FE") ///
eqlabels(none) label varwidth(25) nonumbers ///
prehead("{\begin{tabular*}{0.83\textwidth}{ @{\extracolsep{\fill}\hspace{\tabcolsep}} lcccccc @{\hspace{\tabcolsep}}}") width(0.83\textwidth) ///
posthead("\multicolumn{7}{l}{\textit{Panel A. First year}} \\" ///
" \toprule" ///
" & \multicolumn{2}{c}{All subjects} & \multicolumn{1}{c}{Non-MI} & \multicolumn{3}{c}{MI} \\" ///
" \cmidrule(lr){2-3} \cmidrule(lr){4-4} \cmidrule(lr){5-7}" ///
" & \multicolumn{1}{c}{(1)} & \multicolumn{1}{c}{(2)} & \multicolumn{1}{c}{(3)} & \multicolumn{1}{c}{(4)} &\multicolumn{1}{c}{(5)} &\multicolumn{1}{c}{(6)}\\" ///
" \midrule" ) ///
nonumbers mlabels(none) se(%9.2f) ///
booktabs nonotes ///
replace



********************************************************************************
*
*                              LATER YEARS
*
********************************************************************************


egen ns_mean_perc_y2 = mean(Percentage_y2), by(Course_NatSci_split)
egen ns_sd_perc_y2   = sd(Percentage_y2), by(Course_NatSci_split)
gen ns_std_perc_y2   = (Percentage_y2 - ns_mean_perc_y2) / ns_sd_perc_y2

reg ns_std_perc_y2 i.type i.Course_NatSci_split i.ApplyCollege if EEMP == 1, vce(robust)
onesided 2.type
estadd local course_fe "\checkmark"
estadd local offer_college_fe ""
estadd local apply_college_fe "\checkmark"
eststo r1

egen ns_mean_perc_y3 = mean(Percentage_y3), by(Course_NatSci_split)
egen ns_sd_perc_y3   = sd(Percentage_y3), by(Course_NatSci_split)
gen ns_std_perc_y3   = (Percentage_y3 - ns_mean_perc_y3) / ns_sd_perc_y3

reg ns_std_perc_y3 i.type i.Course_NatSci_split  i.ApplyCollege if EEMP == 1, vce(robust)
onesided 2.type
estadd local course_fe "\checkmark"
estadd local offer_college_fe ""
estadd local apply_college_fe "\checkmark"
eststo r2

esttab r1 r2 using "${tables}gender_main_B.tex", cells(b(pval(pval) fmt(2)) se(par fmt(2))) keep(2.type) collabels(none) star(* 0.10 ** 0.05 *** 0.01)  ///
scalars("course_fe Subject FE" ///
"apply_college_fe Application college FE") ///
eqlabels(none) label varwidth(25) nonumbers ///
prehead("{\begin{tabular*}{0.83\textwidth}{ @{\extracolsep{\fill}\hspace{\tabcolsep}} lcc @{\hspace{\tabcolsep}}}") width(0.83\textwidth) ///
posthead("\multicolumn{3}{l}{ } \\ " ///
" \multicolumn{3}{l}{\textit{Panel B. Later years: Mathematically intesive subjects}} \\ " ///
" \toprule " ///
" & \multicolumn{1}{c}{Second year} & \multicolumn{1}{c}{Third year}" ///
"\\ \cmidrule(lr){2-2}\cmidrule(lr){3-3}" ///
" & (1) & (2) \\ \midrule " ) ///
nonumbers mlabels(none) se(%9.3f) ///
booktabs nonotes ///
replace

